package org.zappee.dannyt.cairngorm.service
{
	import mx.collections.ArrayCollection;
	import mx.collections.IList;
	import mx.rpc.IResponder;
	
	import org.zappee.dannyt.cairngorm.business.Bug;
	
	public class BugDelegate extends CommonMockDelegate
	{
		public function BugDelegate(responder: IResponder)
		{
			super(responder);
			this.Latency = 1000;
		}
		
		public function getBugs() : void
		{	
			//create the mockup list of items
			var bugs:IList = createBugs();
			//call async responder
			setResults(bugs);
		}
		
		private function createBugs():IList
		{
			
			var bugList:IList = new ArrayCollection();
			
			var bug:Bug = new Bug();
			bug.Id=1;
			bug.Title="Can't save new bugs";
			bug.OpenedBy="dan@moov2.com";
			bug.AssignedTo="peter@moov2.com";
			bug.Priority = Bug.PRIORITY_HIGH;
			bugList.addItem(bug);
			
			bug = new Bug();
			bug.Id = 2;
			bug.Title = "Need to cancel bug";
			bug.OpenedBy = "mike@moov2.com";
			bug.AssignedTo = "dan@moov2.com";
			bug.Priority = Bug.PRIORITY_MEDIUM;
			bugList.addItem(bug);
			
			bug = new Bug();
			bug.Id = 3;
			bug.Title = "Can't view list";
			bug.OpenedBy = "andrea@moov2.com";
			bug.AssignedTo = "peter@moov2.com";
			bug.Priority = Bug.PRIORITY_HIGH;
			bugList.addItem(bug);

			return bugList;
		}
	}
}